﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using MMOEng.Components;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System.Windows.Forms;

namespace MMOEng.SubSystems
{
    public class RenderSubSystem : BaseSubSystem<RenderComponent>
    {
        public RenderSubSystem(MMOGame game)
            : base(game)
        {

        }
        public override void UpdateComponent(BaseComponent component)
        {
            RenderComponent c = component as RenderComponent;
            c.UpdateComponent(this.GetComponent(component.guid), c);
        }

        public override void RegisterComponent()
        {
            game.SubSystemsManager.RegisterUpdateCallback(typeof(RenderComponent).FullName, this.UpdateComponent);
        }

        public override void Update(GameTime gameTime)
        {
        }

        public override void Draw(GameTime gameTime){
            foreach (RenderComponent c in componentStore.Values)
            {
                this.DrawRenderComponent(c);
            }
        }

        private void DrawRenderComponent(RenderComponent c)
        {
        }

        public override void LoadContent()
        {
        }
    }
}
